package NGUYENTHECUONG.JAVA_FOR_BASE;

import java.util.Scanner;

public class TAMGIAC {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		System.out.println("Nhap vao cac canh cua tam giac");
		System.out.println("Nhap vao canh 1-a :");
		Scanner sc =new Scanner(System.in);
		int a=sc.nextInt();
		System.out.println("nhap vai canh 2 -b");
		int b =sc.nextInt();
		System.out.println("nhap vao canh 3 -c");
		int c=sc.nextInt();
		// kiem tra co phai la tam giac khong
		if((a+b>c) &&(a+c>b) && (b+c>a) && (a>0) && (b>0) && (c>0)){
			float p=(a+b+c)/2;
			float f =p*(p-a)*(p-b)*(p-c);
			float dientich=(float) Math.sqrt(f);
			System.out.println("f laf: "+ f);
			System.out.println(" dien tich tam giac la : "+ dientich);
		}
		else System.out.println("cac canh nhap vao khong phai la tam giac");
	}

}
